{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# C++ kernel with Cling\n",
    "\n",
    "[Cling](https://cern.ch/cling) is an interpreter for C++.\n",
    "\n",
    "Yup, this is a thing."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": []
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "class Rectangle {\n",
    "    private:\n",
    "        double w;\n",
    "        double h;\n",
    "\n",
    "    public:\n",
    "    \n",
    "        Rectangle(double w_, double h_) {\n",
    "            w = w_;\n",
    "            h = h_;\n",
    "        }\n",
    "        double area(void) {\n",
    "            return w * h;\n",
    "        }\n",
    "        double perimiter(void) {\n",
    "            return 2 * (w + h);\n",
    "        }\n",
    "};"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(double) 20.000000\n"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Rectangle r = Rectangle(5, 4);\n",
    "r.area();"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1minput_line_8:2:4: \u001b[0m\u001b[0;1;31merror: \u001b[0m\u001b[1mno member named 'methodmissing' in 'Rectangle'\u001b[0m\n",
      " r.methodmissing();\n",
      "\u001b[0;1;32m ~ ^\n",
      "\u001b[0m"
     ]
    },
    {
     "ename": "ename",
     "evalue": "evalue",
     "output_type": "error",
     "traceback": []
    }
   ],
   "source": [
    "r.methodmissing();"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++14",
   "language": "",
   "name": "cling-cpp14"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".c++",
   "mimetype": " text/x-c++src",
   "name": "c++"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
